<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                       <div class="row" id="order-summary-stats-panel">
    <div class="col-md-3">
        <div class="well">
            <b>
                今日充值 <i class="fa fa-question-circle" title="非实时, 延迟 5 分钟左右"></i>
                
            </b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                ￥<span data-bind="price: stats_today.paid_amount">{$pays_day.total}</span>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6" style="padding:0">
                        <strong>普通充值</strong>
                        <div><b class="text-primary" data-bind="price: stats_today.welth_order_paid_amount">{$pays_day.total}</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_today.welth_order_paid_count">{$pays_day.already_paid}</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_today.welth_order_unpaid_count">{$pays_day.unpaid}</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_today.welth_order_completion_rate() * 100)">{$pays_day.rate}</span> %</b>
                        </div>
                    </div>
                    <div class="col-sm-6" style="padding:0">
                        <strong>年费VIP会员</strong>
                        <div><b class="text-primary" data-bind="price: stats_today.vip_order_paid_amount">0.00</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_today.vip_order_paid_count">0</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_today.vip_order_unpaid_count">0</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_today.vip_order_completion_rate() * 100)">0</span> %</b>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    

    <div class="col-md-3">
        <div class="well">
            <b>昨日充值<i class="fa fa-question-circle" title="不含当日，非实时，每天凌晨2:30左右更新"></i> </b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                ￥<span data-bind="price: stats_yesterday.paid_amount">{$pays_today.total}</span>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6" style="padding:0">
                        <strong>普通充值</strong>
                        <div><b class="text-primary" data-bind="price: stats_yesterday.welth_order_paid_amount">{$pays_today.total}</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_yesterday.welth_order_paid_count">{$pays_today.already_paid}</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_yesterday.welth_order_unpaid_count">{$pays_today.unpaid}</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_yesterday.welth_order_completion_rate() * 100)">{$pays_today.rate}</span> %</b>
                        </div>
                    </div>
                    <div class="col-sm-6" style="padding:0">
                        <strong>年费VIP会员</strong>
                        <div><b class="text-primary" data-bind="price: stats_yesterday.vip_order_paid_amount">0.00</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_yesterday.vip_order_paid_count">0</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_yesterday.vip_order_unpaid_count">0</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_yesterday.vip_order_completion_rate() * 100)">0</span> %</b>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-3">
        <div class="well">
            <b>本月充值<i class="fa fa-question-circle" title="不含当日，非实时，每天凌晨2:30左右更新"></i> </b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                ￥<span data-bind="price: stats_this_month.paid_amount">{$pays_month.total}</span>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6" style="padding:0">
                        <strong>普通充值</strong>
                        <div><b class="text-primary" data-bind="price: stats_this_month.welth_order_paid_amount">{$pays_month.total}</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_this_month.welth_order_paid_count">{$pays_month.already_paid}</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_this_month.welth_order_unpaid_count">{$pays_month.unpaid}</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_this_month.welth_order_completion_rate() * 100)">{$pays_month.rate}</span> %</b>
                        </div>
                    </div>
                    <div class="col-sm-6" style="padding:0">
                        <strong>年费VIP会员</strong>
                        <div><b class="text-primary" data-bind="price: stats_this_month.vip_order_paid_amount">0.00</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_this_month.vip_order_paid_count">0</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_this_month.vip_order_unpaid_count">0</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_this_month.vip_order_completion_rate() * 100)">0</span> %</b>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-3">
        <div class="well">
            <b>累计充值 <i class="fa fa-question-circle" title="不含当日，非实时，每天凌晨2:30左右更新"></i> </b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                ￥<span data-bind="price: stats_all_time.paid_amount">{$pays_altogether.total}</span>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6" style="padding:0">
                        <strong>普通充值</strong>
                        <div><b class="text-primary" data-bind="price: stats_all_time.welth_order_paid_amount">{$pays_altogether.total}</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_all_time.welth_order_paid_count">{$pays_altogether.already_paid}</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_all_time.welth_order_unpaid_count">{$pays_altogether.unpaid}</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_all_time.welth_order_completion_rate() * 100)">{$pays_altogether.rate}</span> %</b>
                        </div>
                    </div>
                    <div class="col-sm-6" style="padding:0">
                        <strong>年费VIP会员</strong>
                        <div><b class="text-primary" data-bind="price: stats_all_time.vip_order_paid_amount">0.00</b></div>
                        <div>已支付: <b class="text-warning" data-bind="text: stats_all_time.vip_order_paid_count">0</b> 笔</div>
                        <div>未支付: <b class="text-warning" data-bind="text: stats_all_time.vip_order_unpaid_count">0</b> 笔</div>
                        <div>
                            完成率: <b class="text-warning"><span data-bind="text: Math.round(stats_all_time.vip_order_completion_rate() * 100)">0</span> %</b>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
</div>
                       <table class="table table-bordered table-striped" data-bind="visible: !loading()">
        <thead>
            <tr>
                <th>日期</th>
                <th class="text-right">充值金额</th>
                <th class="text-right">普通充值</th>
                <th class="text-right">普通充值支付订单数</th>
                <th class="text-right">年费VIP会员</th>
                <th class="text-right">年费VIP会员支付订单数</th>
            </tr>
        </thead>
       <tbody data-bind="foreach: month">
		<volist name="month" id="day">
            <tr>
                <td><span data-bind="date: date">{$day['time']}</span></td>
                <td class="text-right">
                    <b>￥ <span data-bind="price: paid_amount">{$day['money']}</span></b>
                </td>
                <td class="text-right">
                    <b>￥ <span data-bind="price: welth_order_paid_amount">{$day['money']}</span></b>
                    <div class="text-muted" style="font-size:13px;margin-top:5px">
                        充值人数: <span data-bind="text: welth_order_paid_user_count">{$day['count']}</span>,
                        人均: ￥ <span data-bind="price: welth_order_avg_user_paid_amount">0.00</span>
                    </div>
                </td>
                <td class="text-right">
                    <b><span data-bind="text: welth_order_paid_count">{$day['count']}</span> 笔</b>
                    <div class="text-muted" style="font-size:13px;margin-top:5px">
                        <span data-bind="text: welth_order_unpaid_count">{$day['ncount']}</span> 笔未支付,
                        完成率: <span data-bind="text: Math.round(welth_order_completion_rate * 100)">{$day['rate']}</span> %
                    </div>
                </td>
                <td class="text-right">
                    <b>￥ <span data-bind="price: vip_order_paid_amount">0.00</span></b>
                    <div class="text-muted" style="font-size:13px;margin-top:5px">
                        充值人数: <span data-bind="text: vip_order_paid_user_count">0</span>,
                        人均: ￥ <span data-bind="price: vip_order_avg_user_paid_amount">0.00</span>
                    </div>
                </td>
                <td class="text-right">
                    <b><span data-bind="text: vip_order_paid_count">0</span> 笔</b>
                    <div class="text-muted" style="font-size:13px;margin-top:5px">
                        <span data-bind="text: vip_order_unpaid_count">0</span> 笔未支付,
                        完成率: <span data-bind="text: Math.round(vip_order_completion_rate * 100)">0</span> %
                    </div>
                </td>
            </tr>
        </volist>     
    </table>
</div> 
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $("#tabs").tabs();
        var editor = KindEditor.create('textarea[name="content"]', {
            uploadJson: '__PUBLIC__/kindeditor/php/upload_json.php',
            fileManagerJson: '__PUBLIC__/kindeditor/php/file_manager_json.php',
            allowFileManager: true,
            afterBlur: function () {
                this.sync();
            }
        });
        $(".submit").click(function () {
            var classid = $("#class_id").val();
            var otherclassid = $("#other_class_id").val();
            var title = $("#title").val();
            var content = $("#content").val();
            var description = $("#description").val();
            if (classid == 0) {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说分类必须选择。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (otherclassid == 0) {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说特别分类必须选择。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }            
            if (title == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "文章标题必须填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (description == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说摘要必须填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }            
            $("#form").submit();
        });
        
        $("#class_id").change(function(){
        	var class_name = $("#class_id").find("option:selected").text();
        	class_name = class_name.replace(/-/g,"");
        	$("#class_name").val(class_name);
        });
        
        $("#other_class_id").change(function(){
        	var class_name = $("#other_class_id").find("option:selected").text();
        	class_name = class_name.replace(/-/g,"");
        	$("#other_class_name").val(class_name);
        });        
    });
</script>
</body>
</html>
